/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.model.events;

/**
 * <p>This is a subclass of XREEvent that represents the "onFlashMetadata" event. It defines some properties specific to
 * this event. Note that values of all custom properties are actually stored in the XREEvent#params map.</p>
 *
 * <p><strong>Thread safety:</strong> This class is mutable and not thread safe.</p>
 *
 * @author saarixx, jmn
 * @version 1.0
 */
@SuppressWarnings("boxing")
public class XREFlashMetadataEvent extends XREResourceEvent {

    /**
     * <p>Represents the name of the "on flash metadata" event.</p>
     *
     * <p>This is a string constant used by the user when setting the name of the event.</p>
     */
    public static final String ON_FLASH_METADATA_EVENT_NAME = "onFlashMetadata";

    /**
     * <p>Represents the name used to retrieve the height parameter.</p>
     */
    private static final String HEIGHT = "height";

    /**
     * <p>Represents the name used to retrieve the width parameter.</p>
     */
    private static final String WIDTH = "width";

    /**
     * <p>Creates new instance of {@link XREFlashMetadataEvent} class.</p>
     */
    public XREFlashMetadataEvent() {
        // empty constructor
    }

    /**
     * <p>Retrieves the native width of the SWF, in pixels, before scaling or fitting.</p>
     *
     * @return the native width of the SWF, in pixels, before scaling or fitting
     *
     * @throws IllegalStateException if the requested parameter has wrong type in the parameters map or params is null
     */
    public double getWidth() {
        return getTypedParam(WIDTH, Double.class);
    }

    /**
     * <p>Sets the native width of the SWF, in pixels, before scaling or fitting.</p>
     *
     * @param width the native width of the SWF, in pixels, before scaling or fitting
     *
     * @throws IllegalStateException if params is null
     */
    public void setWidth(double width) {
        setParam(WIDTH, width);
    }

    /**
     * <p>Retrieves the native height of the SWF, in pixels, before scaling or fitting.</p>
     *
     * @return the native height of the SWF, in pixels, before scaling or fitting
     *
     * @throws IllegalStateException if the requested parameter has wrong type in the parameters map or params is null
     */
    public double getHeight() {
        return getTypedParam(HEIGHT, Double.class);
    }

    /**
     * <p>Sets the native height of the SWF, in pixels, before scaling or fitting.</p>
     *
     * @param height the native height of the SWF, in pixels, before scaling or fitting
     *
     * @throws IllegalStateException if params is null
     */
    public void setHeight(double height) {
        setParam(HEIGHT, height);
    }
}

